import request from '@/utils/request'
import {brandList, regions, reqData,createBrandData, editBrandData, Ids} from "@/api/brand/type.ts";
import {ResponseData} from "@/api/types/type";
//getBrandList 获取品牌列表
export function getBrandList(data: reqData): Promise<brandList> {
    return request({
        url: '/brand/list',
        data,
        method: 'post'
    })
}

//CreateBrand 创建品牌
export function createBrand(data: createBrandData): Promise<ResponseData> {
    return request({
        url: '/brand/createBrand',
        data,
        method: 'post'
    })
}

export function getBrandRegion(): Promise<regions> {
    return request({
        url: '/brand/region',
        method: 'get'
    })
}

export function getBrandCategory(): Promise<regions> {
    return request({
        url: '/brand/category',
        method: 'get'
    })
}

export function addReOrCatApiFunc(data:any): Promise<ResponseData> {
    return request({
        url: '/brand/createRegOrCat',
        data,
        method: 'post'
    })
}

export function updateBrand(data: editBrandData): Promise<ResponseData> {
    return request({
        url: '/brand/updateBrand',
        data,
        method: 'post'
    })
}
export function deleteBrand(id: number): Promise<ResponseData>{
    return request({
        url: '/brand/deleteBrand/'+id,
        method: 'delete'
    })
}
export function BatchDeleteBrand(ids: Ids): Promise<ResponseData> { 
    return request({
        url: '/brand/batchDeleteBrand',
        data: {ids: ids},
        method: 'delete'
    })
}